package com.java.exer_2;

public class Poker {
    //花色： 0~3   0：黑桃  1：红桃   2：梅花   3：方块
    private int type;
    //数值： 1~13
    private int num;

    public Poker(int type, int num) {
        //this 预置对象
        this.type = 0;
        this.num = 1;
        //修正
        if (type < 0 || type > 3 || this.num < 1 || this.num > 13) {
            return;
        }
        this.type = type;
        this.num = num;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        String[] types = {"♠", "♥", "♣", "♦"};
        String[] pointers = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        return types[this.type] + pointers[this.num - 1];
    }

}
